package java46.oo5;

public class JavaTeacer {

	private String name;
	private int age;// 不能小雨22岁的约束

	private String xueli, position;

	public JavaTeacer(String n, int a, String xue, String p) {
		name = n;
		// age = a;
		setAge(a);// 构造方法可以调用实例方法
		xueli = xue;
		position = p;
	}

	// 只给name
	public JavaTeacer(String n) {
		name = n;
	}

	// 只给name和age赋值
	public JavaTeacer(String n, int a) {
		System.out.println("给name和age赋值");
		name = n;
		setAge(a);
	}

	// 给name和xueli赋值
	public JavaTeacer(String n, String x) {
		name = n;
		xueli = x;
	}

	// // 给name和postion赋值
	// public JavaTeacer(String n, String p) {
	// name = n;
	// position = p;
	// }

	public String getXueli() {
		return xueli;
	}

	public void setXueli(String xueli) {

		this.xueli = xueli;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public void setName(String n) {
		name = n;
	}

	public String getName() {
		return name;
	}

	public void setAge(int a) {
		if (a < 22) {
			System.err.println("年龄设置有问题，小于22岁");
			a = 22;// 默认值
		}
		age = a;
	}

	public int getAge() {
		return age;
	}

	// private void increase() {
	// age++;
	// }

	public void selfIntroduction() {

		System.out.println("我叫" + name + "，今年" + age + "岁，学历是" + xueli);
		System.out.println("职务是" + position);
	}

}
